<extend name="Public/layout"/>

<block name="body">
    <form action="__SELF__" method="post" class="form">
        <neq name="info.id" value="1">
            <div class="form-group">
                <label class="item-label">部门<span class="check-tips">（所属的部门）</span></label>
                <div class="controls">
                    <select name="group" class="form-control">
                        <volist name="all_group" id="group">
                            <option value="{$group.id}" 
                                <php>if($group['id'] == $info['group']) echo 'selected="selected"';</php> >
                                {$group.title_show}
                            </option>
                        </volist>
                    </select>
                </div>
            </div>
        </neq>
        <div class="form-group">
            <label class="item-label">用户名<span class="check-tips">（用户名）</span></label>
            <div class="controls">
                <input type="text" class="form-control" name="username" value="{$info.username|default=''}">
            </div>
        </div>
        <div class="form-group">
            <label class="item-label">邮箱<span class="check-tips">（邮箱）</span></label>
            <div class="controls">
                <input type="text" class="form-control" name="email" value="{$info.email|default=''}">
            </div>
        </div>
        <div class="form-group">
            <label class="item-label">手机号码<span class="check-tips">（手机号码）</span></label>
            <div class="controls">
                <input type="text" class="form-control" name="mobile" value="{$info.mobile|default=''}">
            </div>
        </div>
        <div class="form-group">
            <label class="item-label">密码<span class="check-tips">（修改密码）</span></label>
            <div class="controls">
                <input type="text" class="form-control" name="password" value="">
            </div>
        </div>
        <div class="form-group">
            <label class="item-label">用户头像<span class="check-tips">（用户头像）</span></label>
            <div class="controls">
                <div id="upload"></div>
                <div id="preview">
                    <input type="hidden" name="avatar" value="{$info.avatar}">
                    <img style="margin-top:8px;width:120px;height:120px;" src="{$info.avatar|get_cover}">
                </div>
                <link rel="stylesheet" type="text/css" href="__PUBLIC__/huploadify/huploadify.css">
                <script type="text/javascript" src="__PUBLIC__/huploadify/huploadify.js" charset="utf-8"></script>
                <script type="text/javascript">
                    $('#upload').Huploadify({
                        uploader:'{:U("Index/upload")}',
                        fileTypeExts:'*.gif;*.jpg;*.jpeg;*.png;*.bmp',
                        fileSizeLimit:{:C('UPLOAD_IMAGE_SIZE')}*1024,
                        buttonText:'上 传 图 片',
                        onUploadComplete:function(file, data){
                            var data = $.parseJSON(data);
                            $('#preview img').attr('src', data.url);
                            $('#preview input').attr('value', data.id);
                        }
                    });
                </script>
            </div>
        </div>
        <div class="form-group">
            <input type="hidden" name="id" value="{$info.id|default=''}">
            <button class="btn btn-primary submit ajax-post"  type="submit" target-form="form">确 定</button>
            <button class="btn return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>
